package com.baidu.shoppingmall.role.demo;


import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

public class Demo02 {
    private Integer id;

    private String name;

    public Integer getId() {
        return id;
    }

    @Override
    public String toString() {
        return "Demo02{" +
                "id=" + id +
                ", name='" + name + '\'' +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Demo02 demo02 = (Demo02) o;
        return Objects.equals(id, demo02.id) &&
                Objects.equals(name, demo02.name);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, name);
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

}

class Demo03{
    public static void main(String[] args) {
        Map<Demo02, Object> map = new HashMap<>();
        Demo02 demo02 = new Demo02();
        demo02.setId(1);
        demo02.setName("y");

        Demo02 demo021 = new Demo02();
        demo021.setId(1);
        demo021.setName("y");


        map.put(demo02, "p");
        map.put(demo021, "q");

        System.out.println(map);

        short s=1;
        int i =(int) s + 1;

    }
}